package com.msb.test01;

import java.sql.*;

public class Test {
    public static void main(String[] args) throws ClassNotFoundException, SQLException {
    Class.forName("com.mysql.cj.jdbc.Driver");
//通过DriverManger获取数据连接--（输电话号）
        String url = "jdbc:mysql://localhost:3306/sxs";
        String username = "root";
        String password = "123456";
        Connection conn = DriverManager.getConnection(url, username, password);
        Statement sta=conn.createStatement();

        ResultSet rs = sta.executeQuery("select * from t_book where price>10");
        while (rs.next()){
            System.out.println(rs.getInt("id"));

        }
        sta.close();
        conn.close();

    }
}
